package com.dt.global.web.action.zhengym;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.hibernate.HibernateException;
import org.springframework.context.annotation.Scope;

import com.dt.components.exstruts.action.BaseActionSupport;
import com.dt.components.exutils.PageUtil;
import com.dt.global.entitys.bo.TWebCoreArticle;
import com.dt.global.entitys.bo.TWebCoreChannel;
import com.dt.global.entitys.bo.TWebCoreMien;
import com.dt.global.utils.Proerties;
import com.dt.global.web.mar.Newscentrality.NewscentralityMar;
import com.dt.global.web.mar.articleQuery.ArticleQueryMar;
import com.dt.global.web.mar.repquery.RepQueryMar;

/**
 * 镇（街道）查询
 * @author MWG
 *
 */
@SuppressWarnings("serial")
@Scope("prototype")
public class InitZhengNewsAction  extends BaseActionSupport{
	@Resource
	public NewscentralityMar newMar;
	@Resource
	private RepQueryMar repQueryMar;
	@Resource
	public ArticleQueryMar articleQueryMar;
	@Resource
	private NewscentralityMar newscentralityMar;
	public String initIndex() {
		try{
			//默认显示五张
			int rows = 5;
			String path = getRequest().getContextPath();
			Proerties popUtil = new Proerties();
			String url = popUtil.getValue("wjrdht");
			String pathDetail = path + "/zhengymquery/getNewsInfoClose.do";
			String spics = null;
			String stexts = null;
			String slinks = null;
			String pid = getRequest().getParameter("pid");
			String channelId="";
			//跳转指定页面
			String zhi="zsuccess";
			//判断是哪个镇的新闻
			if(pid!=null&&!pid.equals("")){
				if(pid.equals("11")){//万春镇
					channelId="channelId201311281585793176404992";
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
					//zhi="zsuccess";
				}else if(pid.equals("13")){ //和盛镇
					channelId="channelId201311281585816109761536";
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
					//zhi="zsuccess";
				}else if(pid.equals("15")){ //永宁镇
					channelId="channelId201311281585828674683904";
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
					//zhi="zsuccess";
				}else if(pid.equals("12")){ //寿安镇
					channelId="channelId201311281585802393945088";
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
					//zhi="zsuccess";
				}else if(pid.equals("16")){ //柳城街道
					channelId="channelId201311281585833787163648";
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
					//zhi="jdsuccess";
				}else if(pid.equals("22")){ //文教卫体口
					channelId="channelId201311281585862286345216";
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
					//zhi="jdsuccess";
				}else if(pid.equals("17")){ //天府街道
					channelId="channelId201311281585839353283584";
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
					//zhi="jdsuccess";
				}else if(pid.equals("18")){ //涌泉街道
					channelId="channelId201311281585844478870528";
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
					//zhi="jdsuccess";
				}else if(pid.equals("19")){ //公平街道
					channelId="channelId201311281585848889607168";
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
					//zhi="jdsuccess";
				}else if(pid.equals("20")){ //永盛镇
					channelId="channelId201311281585853229827072";
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
					//zhi="zsuccess";
				}else if(pid.equals("21")){ //金马镇
					channelId="channelId201311281585857086456832";
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
					//zhi="zsuccess";
				}
				//加载新闻资讯图片新闻
				List<TWebCoreArticle> listxwzx=newMar.getTWebCoreArticle(channelId);
				if (listxwzx!=null&&listxwzx.size()!=0){
					if(listxwzx.size()<5){
						rows = listxwzx.size();
					}
					for (int getrows=0;getrows<rows;getrows++){
						TWebCoreArticle entityA = (TWebCoreArticle) listxwzx.get(getrows);
						String path1 =ServletActionContext.getServletContext().getRealPath(entityA.getTitleImg());
						File file = new File(path1);
						if(spics==null){
							spics = url+"/uploadfile"+entityA.getTitleImg();
						}else{
							spics =spics+"|"+url+"/uploadfile"+entityA.getTitleImg();
						}
						if(stexts==null){
							stexts = entityA.getTitle();
							stexts = stexts.length()>15?stexts.substring(0, 15)+"..":stexts;
						}else{
							String title = entityA.getTitle().length()>15?entityA.getTitle().substring(0, 15)+"..":entityA.getTitle();
							stexts = stexts+"|"+ title;
						}
						if(slinks==null){
							slinks = pathDetail + "?articleId="+entityA.getArticleId()+""+pid;
						}else{
							slinks = slinks + "|" + pathDetail + "?articleId="+entityA.getArticleId()+""+pid;
						}
					}
				}
				getRequest().setAttribute("spics", spics);
				getRequest().setAttribute("stexts", stexts);
				getRequest().setAttribute("slinks", slinks);
				getRequest().setAttribute("pid",pid);
				return zhi;
			}else{
				return "error";
			}
		} catch (Exception e) {
			e.printStackTrace();
			return "error";
		}
	}
	/**
	 * 根据栏目Id(分页)查看栏目信息
	 */
	@SuppressWarnings("unchecked")
	public String getTWebCoreChannelzjdPageQuery()throws HibernateException{
		try{
			String path = getRequest().getContextPath();
			String pid = getRequest().getParameter("pid");
			//跳转指定页面
			String zhi="zsuccess";
			if(pid!=null&&!pid.equals("")){
				if(pid.equals("11")){//万春镇
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
					//zhi="zsuccess";
				}else if(pid.equals("13")){ //和盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
					//zhi="zsuccess";
				}else if(pid.equals("15")){ //永宁镇
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
					//zhi="zsuccess";
				}else if(pid.equals("12")){ //寿安镇
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
					//zhi="zsuccess";
				}else if(pid.equals("16")){ //柳城街道
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
					//zhi="jdsuccess";
				}else if(pid.equals("22")){ //文教卫体口
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
					//zhi="jdsuccess";
				}else if(pid.equals("17")){ //天府街道
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
					//zhi="jdsuccess";
				}else if(pid.equals("18")){ //涌泉街道
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
					//zhi="jdsuccess";
				}else if(pid.equals("19")){ //公平街道
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
					//zhi="jdsuccess";
				}else if(pid.equals("20")){ //永盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
					//zhi="zsuccess";
				}else if(pid.equals("21")){ //金马镇
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
					//zhi="zsuccess";
				}
				Proerties popUtil = new Proerties();
				String url = popUtil.getValue("wjrdht");
				//声明List结果集，用于装载查询结果
				List<Map<String, String>> list = null;
				Map<String, String> map = null;
				HttpServletRequest request = ServletActionContext.getRequest();
				String channelId=getRequest().getParameter("channelId");
				if(channelId !=null&!channelId.equals("")){
					//根据栏目ID查询栏目信息
					TWebCoreChannel twebCoreChannel=newMar.getTWebCoreChannelId(channelId);
					this.initExtableGrid(10);// 每页显示条数
					try {
						PageUtil.setPageDispatchInfo(request,pm);
					} catch (Exception e) {
						e.printStackTrace();
						return "error";
					}
					//根据栏目分页查询栏目信息
					pm = articleQueryMar.getTWebCoreArticleChannelId(pm, channelId);
					int totalNum = pm.getRsCount();
					List<TWebCoreArticle> objList = (List<TWebCoreArticle>) pm.getRsList();
					list = new ArrayList<Map<String, String>>();
					//查询数据结果
					if(totalNum != 0){
						for(TWebCoreArticle article : objList){
							map = new HashMap<String, String>();
							if(article.getTitleImg()!=null&&!article.getTitleImg().equals("")){
								map.put("titleImg",url+"/uploadfile/"+article.getTitleImg());  	
							}else{
								map.put("titleImg",""); 
							}
							map.put("articleId", article.getArticleId());
							if(article.getTitle().length()>36){
								map.put("title", article.getTitle().substring(0,36)+"..."); 
							}else{
								map.put("title", article.getTitle());  
							}
							map.put("releaseSysDate", article.getReleaseSysDate().substring(0,10));
							list.add(map);
						}
					}
					request.setAttribute("channel", twebCoreChannel);
					request.setAttribute(prefix, list);
					request.setAttribute(prefix + "_totalRows",new Integer(totalNum));
					getRequest().setAttribute("pid",pid);
					return zhi;
				}else{
					return "error";
				}
			}else{
				return "error";
			}

		}catch(Exception e){
			e.printStackTrace();
			return "error";
		}
	}
	/**
	 * 根据栏目id分页查看代表风采
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public String getdaibiaofcPageQuery()throws HibernateException{
		try{
			String path = getRequest().getContextPath();
			String pid = getRequest().getParameter("pid");
			//跳转指定页面
			String zhi="zsuccess";
			if(pid!=null&&!pid.equals("")){
				if(pid.equals("11")){//万春镇
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
					//zhi="zsuccess";
				}else if(pid.equals("13")){ //和盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
					//zhi="zsuccess";
				}else if(pid.equals("15")){ //永宁镇
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
					//zhi="zsuccess";
				}else if(pid.equals("12")){ //寿安镇
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
					//zhi="zsuccess";
				}else if(pid.equals("16")){ //柳城街道
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
					//zhi="jdsuccess";
				}else if(pid.equals("22")){ //文教卫体口
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
					//zhi="jdsuccess";
				}else if(pid.equals("17")){ //天府街道
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
					//zhi="jdsuccess";
				}else if(pid.equals("18")){ //涌泉街道
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
					//zhi="jdsuccess";
				}else if(pid.equals("19")){ //公平街道
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
					//zhi="jdsuccess";
				}else if(pid.equals("20")){ //永盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
					//zhi="zsuccess";
				}else if(pid.equals("21")){ //金马镇
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
					//zhi="zsuccess";
				}
				Proerties popUtil = new Proerties();
				String url = popUtil.getValue("wjrdht");
				//声明List结果集，用于装载查询结果
				List<Map<String, String>> list = null;
				Map<String, String> map = null;
				HttpServletRequest request = ServletActionContext.getRequest();
				String channelId=getRequest().getParameter("channelId");
				if(channelId !=null&!channelId.equals("")){
					//根据栏目ID查询栏目信息
					TWebCoreChannel twebCoreChannel=newscentralityMar.getTWebCoreChannelId(channelId);
					this.initExtableGrid(15);// 每页显示条数
					try {
						PageUtil.setPageDispatchInfo(request,pm);
					} catch (Exception e) {
						e.printStackTrace();
						return "error";
					}
					//根据栏目分页查询栏目信息
					pm = articleQueryMar.getdaibiaofcPageQuery(pm, channelId);
					int totalNum = pm.getRsCount();
					List<TWebCoreMien> objList = (List<TWebCoreMien>) pm.getRsList();
					list = new ArrayList<Map<String, String>>();
					//查询数据结果
					if(totalNum != 0){
						for(int i=0;i<objList.size();i++){
							map = new HashMap<String, String>();
							if(objList.get(i).getTitleImg()!=null&&!objList.get(i).getTitleImg().equals("")){
								map.put("titleImg",url+"/uploadfile/"+objList.get(i).getTitleImg());  	
							}else{
								map.put("titleImg",""); 
							}
							map.put("zhi",String.valueOf(i));
							if(objList.get(i).getName()!=null&&!objList.get(i).getName().equals("")){
								map.put("name",objList.get(i).getName());
							}
							if(objList.get(i).getArticleId()!=null&&!objList.get(i).getArticleId().equals("")){
								map.put("articleId", objList.get(i).getArticleId());
							}
							list.add(map);
						}
					}
					request.setAttribute("channel", twebCoreChannel);
					getRequest().setAttribute("pid",pid);
					request.setAttribute(prefix, list);
					request.setAttribute(prefix + "_totalRows",new Integer(totalNum));
					return  zhi;
				}else{
					return "error";
				}
			}else{
				return "error";
			}
		}catch(Exception e){
			e.printStackTrace();
			return "error";
		}
	}
	/**
	 * 跳转查看小组活动信息
	 */
	@SuppressWarnings("unchecked")
	public String getTWebCoreChanneljczlPageQuery()throws HibernateException{
		try{
			String path = getRequest().getContextPath();
			String channelId=getRequest().getParameter("channelId");
			String pid = getRequest().getParameter("pid");
			//跳转指定页面
			String zhi=null;
			if(pid!=null&&!pid.equals("")){
				if(pid.equals("11")){//万春镇
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
				}else if(pid.equals("13")){ //和盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
				}else if(pid.equals("15")){ //永宁镇
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
				}else if(pid.equals("12")){ //寿安镇
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
				}else if(pid.equals("16")){ //柳城街道
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
				}else if(pid.equals("22")){ //文教卫体口
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
				}else if(pid.equals("17")){ //天府街道
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
				}else if(pid.equals("18")){ //涌泉街道
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
				}else if(pid.equals("19")){ //公平街道
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
				}else if(pid.equals("20")){ //永盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
				}else if(pid.equals("21")){ //金马镇
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
				}
				if(channelId !=null&!channelId.equals("")){
					//根据栏目ID查询栏目信息
					TWebCoreChannel twebCoreChannel=newscentralityMar.getTWebCoreChannelId("channelId201309251495128810669056");
					getRequest().setAttribute("pid",pid);
					getRequest().setAttribute("channel", twebCoreChannel);
					return  "success";
				}else{
					return "error";
				}
			}else{
				return "error";
			}

		}catch(Exception e){
			e.printStackTrace();
			return "error";
		}
	}
	/**
	 * 查询新闻详细信息(图片集锦)
	 */
	public String getNewsInfoReturn()throws HibernateException{
		try{
			Proerties popUtil = new Proerties();
			String url = popUtil.getValue("wjrdht");
			String path = getRequest().getContextPath();
			String pid = getRequest().getParameter("pid");
			//跳转指定页面
			String zhi="zsuccess";
			if(pid!=null&&!pid.equals("")){
				if(pid.equals("11")){//万春镇
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
					//zhi="zsuccess";
				}else if(pid.equals("13")){ //和盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
					//zhi="zsuccess";
				}else if(pid.equals("15")){ //永宁镇
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
					//zhi="zsuccess";
				}else if(pid.equals("12")){ //寿安镇
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
					//zhi="zsuccess";
				}else if(pid.equals("16")){ //柳城街道
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
					//zhi="jdsuccess";
				}else if(pid.equals("22")){ //文教卫体口
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
					//zhi="jdsuccess";
				}else if(pid.equals("17")){ //天府街道
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
					//zhi="jdsuccess";
				}else if(pid.equals("18")){ //涌泉街道
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
					//zhi="jdsuccess";
				}else if(pid.equals("19")){ //公平街道
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
					//zhi="jdsuccess";
				}else if(pid.equals("20")){ //永盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
					//zhi="zsuccess";
				}else if(pid.equals("21")){ //金马镇
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
					//zhi="zsuccess";
				}
				TWebCoreChannel twebCoreChannel=null;
				//声明List结果集，用于装载查询结果
				HttpServletRequest request = ServletActionContext.getRequest();
				String articleId=getRequest().getParameter("articleId");
				if(articleId !=null&!articleId.equals("")){
					//根据新闻Id查询新闻信息
					TWebCoreArticle twebCoreArticle=articleQueryMar.getTWebCoreArticleId(articleId);
					if(twebCoreArticle.getChannelId()!=null&&!twebCoreArticle.getChannelId().equals("")){
						//根据栏目ID查询栏目信息
						twebCoreChannel=newscentralityMar.getTWebCoreChannelId(twebCoreArticle.getChannelId());
						request.setAttribute("channel", twebCoreChannel);
					}
					if(twebCoreArticle.getExlink()!=null&&twebCoreArticle.getExlink().length()!=0){
						if(twebCoreArticle.getExlink().contains("http://")){
							String newExlink=twebCoreArticle.getExlink().replace("http://", "");
							twebCoreArticle.setExlink(newExlink);
						}
					}else{
						twebCoreArticle.setExlink("");
					}
					if(twebCoreArticle.getAttachment()!=null&&twebCoreArticle.getAttachment().length()!=0){
						twebCoreArticle.setAttachment(url+"/UploadFiles"+twebCoreArticle.getAttachment());
					}else{
						twebCoreArticle.setAttachment("");
					}
					if(twebCoreArticle.getAttaName()!=null&&twebCoreArticle.getAttaName().length()!=0){
						twebCoreArticle.setAttaName(twebCoreArticle.getAttaName());
					}else{
						twebCoreArticle.setAttaName("");
					}
					if(twebCoreArticle.getViewAddress()!=null&&twebCoreArticle.getViewAddress().length()!=0){
						twebCoreArticle.setViewAddress(url+"/flv"+twebCoreArticle.getViewAddress());
					}else{
						twebCoreArticle.setViewAddress("");
					}
					if(twebCoreArticle.getViewName()!=null&&twebCoreArticle.getViewName().length()!=0){
						twebCoreArticle.setViewName(twebCoreArticle.getViewName());
					}else{
						twebCoreArticle.setViewName("");
					}
					if(twebCoreArticle.getAuthor()!=null&&twebCoreArticle.getAuthor().length()!=0){
						twebCoreArticle.setAuthor(twebCoreArticle.getAuthor());
					}else{
						twebCoreArticle.setAuthor("");
					}
					getRequest().setAttribute("pid",pid);
					request.setAttribute("article", twebCoreArticle);
					return zhi;
				}else{
					return "error";
				}
			}else{
				return "error";
			}
		}catch(Exception e){
			e.printStackTrace();
			return "error";
		}
	}
	/**
	 * 查询新闻详细信息(关闭)
	 */
	public String getNewsInfoClose()throws HibernateException{
		try{
			Proerties popUtil = new Proerties();
			String url = popUtil.getValue("wjrdht");
			String path = getRequest().getContextPath();
			String pid = null;
			TWebCoreChannel twebCoreChannel=null;
			//声明List结果集，用于装载查询结果
			HttpServletRequest request = ServletActionContext.getRequest();
			String articleId=getRequest().getParameter("articleId");
			if(articleId !=null&!articleId.equals("")){
				pid=articleId.substring(33);
				//跳转指定页面
				String zhi="zsuccess";
				if(pid.equals("11")){//万春镇
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
					//zhi="zsuccess";
				}else if(pid.equals("13")){ //和盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
					//zhi="zsuccess";
				}else if(pid.equals("15")){ //永宁镇
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
					//zhi="zsuccess";
				}else if(pid.equals("12")){ //寿安镇
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
					//zhi="zsuccess";
				}else if(pid.equals("16")){ //柳城街道
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
					//zhi="jdsuccess";
				}else if(pid.equals("22")){ //文教卫体口
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
					//zhi="jdsuccess";
				}else if(pid.equals("17")){ //天府街道
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
					//zhi="jdsuccess";
				}else if(pid.equals("18")){ //涌泉街道
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
					//zhi="jdsuccess";
				}else if(pid.equals("19")){ //公平街道
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
					//zhi="jdsuccess";
				}else if(pid.equals("20")){ //永盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
					//zhi="zsuccess";
				}else if(pid.equals("21")){ //金马镇
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
					//zhi="zsuccess";
				}
				//根据新闻Id查询新闻信息
				TWebCoreArticle twebCoreArticle=articleQueryMar.getTWebCoreArticleId(articleId.subSequence(0, 33).toString());
				if(twebCoreArticle.getChannelId()!=null&&!twebCoreArticle.getChannelId().equals("")){
					//根据栏目ID查询栏目信息
					twebCoreChannel=newscentralityMar.getTWebCoreChannelId(twebCoreArticle.getChannelId());
					request.setAttribute("channel", twebCoreChannel);
				}
				if(twebCoreArticle.getExlink()!=null&&twebCoreArticle.getExlink().length()!=0){
					if(twebCoreArticle.getExlink().contains("http://")){
						String newExlink=twebCoreArticle.getExlink().replace("http://", "");
						twebCoreArticle.setExlink(newExlink);
					}
				}else{
					twebCoreArticle.setExlink("");
				}
				if(twebCoreArticle.getAttachment()!=null&&twebCoreArticle.getAttachment().length()!=0){
					twebCoreArticle.setAttachment(url+"/UploadFiles"+twebCoreArticle.getAttachment());
				}else{
					twebCoreArticle.setAttachment("");
				}
				if(twebCoreArticle.getAttaName()!=null&&twebCoreArticle.getAttaName().length()!=0){
					twebCoreArticle.setAttaName(twebCoreArticle.getAttaName());
				}else{
					twebCoreArticle.setAttaName("");
				}
				if(twebCoreArticle.getViewAddress()!=null&&twebCoreArticle.getViewAddress().length()!=0){
					twebCoreArticle.setViewAddress(url+"/flv"+twebCoreArticle.getViewAddress());
				}else{
					twebCoreArticle.setViewAddress("");
				}
				if(twebCoreArticle.getViewName()!=null&&twebCoreArticle.getViewName().length()!=0){
					twebCoreArticle.setViewName(twebCoreArticle.getViewName());
				}else{
					twebCoreArticle.setViewName("");
				}
				if(twebCoreArticle.getAuthor()!=null&&twebCoreArticle.getAuthor().length()!=0){
					twebCoreArticle.setAuthor(twebCoreArticle.getAuthor());
				}else{
					twebCoreArticle.setAuthor("");
				}
				getRequest().setAttribute("pid",pid);
				request.setAttribute("article", twebCoreArticle);
				return zhi;
			}else{
				return "error";
			}

		}catch(Exception e){
			e.printStackTrace();
			return "error";
		}
	}

	/**
	 * 查询代表风采详细信息(返回)
	 */
	public String getRepNewsInfoReturn()throws HibernateException{
		try{
			Proerties popUtil = new Proerties();
			String url = popUtil.getValue("wjrdht");
			String path = getRequest().getContextPath();
			String pid = getRequest().getParameter("pid");
			//跳转指定页面
			String zhi="zsuccess";
			if(pid!=null&&!pid.equals("")){
				if(pid.equals("11")){//万春镇
					getRequest().setAttribute("topimage",path+"/images/logo_wc.png");
					//zhi="zsuccess";
				}else if(pid.equals("13")){ //和盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_hs.png");
					//zhi="zsuccess";
				}else if(pid.equals("15")){ //永宁镇
					getRequest().setAttribute("topimage",path+"/images/logo_yn.png");
					//zhi="zsuccess";
				}else if(pid.equals("12")){ //寿安镇
					getRequest().setAttribute("topimage",path+"/images/logo_sa.png");
					//zhi="zsuccess";
				}else if(pid.equals("16")){ //柳城街道
					getRequest().setAttribute("topimage",path+"/images/logo_lc.png");
					//zhi="jdsuccess";
				}else if(pid.equals("22")){ //文教卫体口
					getRequest().setAttribute("topimage",path+"/images/logo_wjtwk.png");
					//zhi="jdsuccess";
				}else if(pid.equals("17")){ //天府街道
					getRequest().setAttribute("topimage",path+"/images/logo_tf.png");
					//zhi="jdsuccess";
				}else if(pid.equals("18")){ //涌泉街道
					getRequest().setAttribute("topimage",path+"/images/logo_yq.png");
					//zhi="jdsuccess";
				}else if(pid.equals("19")){ //公平街道
					getRequest().setAttribute("topimage",path+"/images/logo_gp.png");
					//zhi="jdsuccess";
				}else if(pid.equals("20")){ //永盛镇
					getRequest().setAttribute("topimage",path+"/images/logo_ys.png");
					//zhi="zsuccess";
				}else if(pid.equals("21")){ //金马镇
					getRequest().setAttribute("topimage",path+"/images/logo_jm.png");
					//zhi="zsuccess";
				}
				TWebCoreChannel twebCoreChannel=null;
				//声明List结果集，用于装载查询结果
				HttpServletRequest request = ServletActionContext.getRequest();
				String articleId=getRequest().getParameter("articleId");
				if(articleId !=null&!articleId.equals("")){
					//根据新闻Id查询新闻信息
					TWebCoreMien twebCoreMine=repQueryMar.getTWebCoreArticleId(articleId);
					if(twebCoreMine.getChannelId()!=null&&!twebCoreMine.getChannelId().equals("")){
						//根据栏目ID查询栏目信息
						twebCoreChannel=newscentralityMar.getTWebCoreChannelId(twebCoreMine.getChannelId());
						request.setAttribute("channel", twebCoreChannel);
					}
					if(twebCoreMine.getIntro()!=null&&twebCoreMine.getIntro().length()!=0){
						request.setAttribute("intro", twebCoreMine.getIntro());
					}else{
						request.setAttribute("intro", "");
					}
					if(twebCoreMine.getName()!=null&&twebCoreMine.getName().length()!=0){
						request.setAttribute("name", twebCoreMine.getName());
					}else{
						request.setAttribute("name", "");
					}
					if(twebCoreMine.getPhone()!=null&&twebCoreMine.getPhone().length()!=0){
						request.setAttribute("phone", twebCoreMine.getPhone());
					}else{
						request.setAttribute("phone", "");
					}
					if(twebCoreMine.getUnit()!=null&&twebCoreMine.getUnit().length()!=0){
						request.setAttribute("unit", twebCoreMine.getUnit());
					}else{
						request.setAttribute("unit", "");
					}
					if(twebCoreMine.getTitleImg()!=null&&twebCoreMine.getTitleImg().length()!=0){
						request.setAttribute("titleImg",url+"/uploadfile/"+twebCoreMine.getTitleImg());
					}else{
						request.setAttribute("titleImg", "");
					}
					request.setAttribute("article", twebCoreMine);
					getRequest().setAttribute("pid",pid);
					return  zhi;
				}else{
					return "error";
				}
			}else{
				return "error";
			}
		}catch(Exception e){
			e.printStackTrace();
			return "error";
		}
	}
}
